<template>
    <mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downRefresh"
        :up="upOption" @up="getData">
        <order-history-item v-for="(item, index) in datas" :item="item" :index="index"
            :key="index"></order-history-item>
    </mescroll-uni>
</template>

<script>
import orderHistoryItem from "@/components/order/order-return-list-item.vue"
import { GetRefundOrderList } from "@/service/api/exChange.js"
export default {
    components: {
        orderHistoryItem,
    },
    props: {
        height: {
            type: String,
            default: "300px",
        },
        userId: {
            type: Number,
            default: 0,
        },
    },
    data() {
        return {
            datas: [],
            allLength: 0,
            data: [],
            productList: [],
            param: {},
            downOption: {
                use: true,
            },
            isLoaded: false,
        }
    },
    mounted() {
        // this.refresh()
    },
    methods: {
        getData(page) {
            let param = this.param
            param.pageIndex = page.num
            param.pageSize = page.size
            param.type = 1 //退单类型
            // param.optType = -1  //0是客户自己退单，1是代客退单，-1取所有数据
            GetRefundOrderList(param).then((res) => {
                this.mescroll.endBySize(res.Data.length, res.Data.TotalAmout)
                this.datas = this.datas.concat(res.Data)
                this.allLength = res.Data.TotalAmout
                this.isLoaded = true
            })
        },
        //刷新
        refresh(param) {
            if (param) {
                this.param = param
            }
            this.downRefresh()
        },
        //刷新
        downRefresh() {
            this.datas = []
            this.mescroll.resetUpScroll()
        },
    },
}
</script>

<style lang="scss">
.list-footer {
    height: 60rpx;
}
</style>
